
import type { UserConfig } from 'vite';

const path = require('path')

const viteConfig: UserConfig = {
  /* 端口号 */
  port: 3000,

  /* hostname */
  hostname: 'localhost',

  /* 运行自动打开浏览器 */
  open:false,
  /* proxy */
  alias: {
    '/@/': path.resolve(__dirname, './src'),
    '/@views/': path.resolve(__dirname, './src/views'),
    '/@components/': path.resolve(__dirname, './src/components'),
    '/@utils/': path.resolve(__dirname, './src/utils'),
  },

  proxy: {   
    '/api': {
      target: 'https://uni937d4b0-6cc760.service.tcloudbase.com',
      changeOrigin: true,
      ws:true,
      rewrite: path => path.replace(/^\/api/, '')
    }
  } 
};

export default viteConfig;